class CardUtil {

  static String getPayCardStr(String code) {
    final int length = code.length;
    if (length <= 4) {
      return '$code****';
    }
    final int replaceLength = length - 4;
    final String replacement = List<String>.generate((replaceLength / 4).ceil(), (int _) => '**** ').join('');
    return code.replaceRange(0, replaceLength, replacement);
  }

}